//
//  MapTableViewController.m
//  UILbrary
//
//  Created by mac on 17/3/3.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "MapTableViewController.h"
#import "MKMapViewController.h"
@interface MapTableViewController ()
@property (nonatomic, strong) NSArray *titleArr;
@property (nonatomic, strong) NSArray *viewControllers;
@end

@implementation MapTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source




- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.titleArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = self.titleArr[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UIViewController *vc = [NSClassFromString(self.viewControllers[indexPath.row]) new];
    [self.navigationController pushViewController:vc animated:YES];
//    if (indexPath.row == 0) {
//        MKMapViewController *mkMapVC = [[MKMapViewController alloc] init];
//        [self.navigationController pushViewController:mkMapVC animated:YES];
//    }
}
#pragma mark - lazy methods
- (NSArray *)titleArr{
    return @[@"iOS 原生地图"];
}

- (NSArray *)viewControllers{
    if (!_viewControllers) {
        _viewControllers = @[@"NativeMapViewController"];
    }
    return _viewControllers;
}
@end
